package com.yiyi.credit.manage.abutment.common.utils;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;


public class UUIDUtil {

    public static String randomUUID() {
        return UUID.randomUUID().toString().replace("-", "").toLowerCase();
    }

    public static String randomUppercaseUUID() {
        return UUID.randomUUID().toString().replace("-", "").toUpperCase();
    }

    public static String generateOrdId() {
        DateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String uuid = format.format(new Date().getTime()) + new Double(Math.random() * 100000).intValue();
        while (uuid.length() < 22) {
            uuid = uuid + "0";
        }
        uuid = uuid.substring(2);
        return uuid;
    }

    public static void main(String[] args) {

        System.out.println(generateOrdId());
        /*System.out.println((75513.37 * 1.78 / 100 * Math.pow((1 + 1.78 / 100), 24)) / (Math.pow((1 + 1.78 / 100), 24) - 1));
        ;

        BigDecimal repaymentPrincipal = BigDecimal.valueOf(75513.37);
        BigDecimal monthInterestRate = BigDecimal.valueOf(12.68 / 12 / 100);
        int period = 24;

        BigDecimal eachPeriodPayment = repaymentPrincipal
                .multiply(monthInterestRate)
                .multiply(BigDecimal.ONE.add(monthInterestRate).pow(period))
                .divide(BigDecimal.ONE.add(monthInterestRate).pow(period)
                                .subtract(BigDecimal.ONE), 8,
                        BigDecimal.ROUND_HALF_UP);


        System.out.println(eachPeriodPayment.doubleValue());*/


    }

}
